package com.zb.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zb.entity.ZjWorkSpareLogImage;
import com.zb.mapper.ZjWorkSpareLogImageMapper;
import com.zb.service.ZjWorkSpareLogImageService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 工单备件记录图片表 服务实现类
 * </p>
 *
 * @author WEN
 * @since 2023-10-27
 */
@Service
public class ZjWorkSpareLogImageServiceImpl extends ServiceImpl<ZjWorkSpareLogImageMapper, ZjWorkSpareLogImage> implements ZjWorkSpareLogImageService {

    // 根据工单备件日志ID获取日志图片
    @Override
    public List<ZjWorkSpareLogImage> getByWorkSpareLogIds(List<Long> workSpareLogIds) {
        if (CollectionUtil.isEmpty(workSpareLogIds)) {
            return new ArrayList<>();
        }
        QueryWrapper<ZjWorkSpareLogImage> wrapper = new QueryWrapper<>();
        wrapper.select("id", "work_spare_log_id", "image");
        wrapper.in("work_spare_log_id", workSpareLogIds);
        return this.list(wrapper);
    }
}
